<?php
  defined('_JEXEC') or die();
  jimport('joomla.application.component.model');
  require_once('base.php');
  
  class DivisionModelDivision extends BaseModel 
  {       
    var $_name        = "division";
    var $_table       = "#__pbny_divisions";
    
    function get_by_team_id($team_id){
    
      $sql = 'SELECT d.* '.
                   'FROM #__pbny_divisions d '.
                   'LEFT JOIN #__pbny_division_conferences dc on dc.division_id=d.id '.
                   'LEFT JOIN #__pbny_conference_teams ct on ct.conference_id = dc.conference_id '.
                   "WHERE ct.team_id=$team_id";
           
      return $this->_get($sql);
    }
  }
?>